﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
    assembly="SAKS.Models"
    namespace="SAKS.Models">
  <class name="Achievement">
    <id name="Id">
      <generator class ="guid.comb" />
    </id>
    <version name="Version" />
    
    <property name="Name" not-null="true"/>
    <property name="RegistrationNumber"/>
    <property name="StartDate"/>
    <property name="EndDate"/>
    <property name="PlunNumber"/>
    <property name="MissionOrigin"/>
    <property name="PropertyRightBelongTo"/>
    <property name="AchievementType"/>
    <property name="AchievementLevel"/>
    <property name="IntellectualPropertyState"/>
    <property name="SecrecyLevel"/>
    <property name="ApplicationDomain"/>
    <property name="TransferScope"/>
    <property name="AchievementSummary"/>
    <property name="CreatedDate"/>
    <property name="PrimaryCompletePerson"/>
    <property name="PrimaryCompleteOrganization"/>

    <one-to-one name="Evaluation" class="SAKS.Models.AchiEvaluation,SAKS.Models" cascade="all-delete-orphan " fetch="join" />

    <bag name="Contributors" cascade="all" inverse="true">
      <key column="AchievementId"/>
      <one-to-many class="SAKS.Models.AchievementContributor,SAKS.Models"/>
    </bag>
    
    <bag name="AcademicPapers"  inverse="true">
      <key column="AchievementId"/>
      <one-to-many class="SAKS.Models.AcademicPaper,SAKS.Models"/>
    </bag>
    
    <bag name="Awards" table="Achi_Awards" cascade="all" >
      <key column="AchievementId"/>
      <many-to-many class="SAKS.Models.Award,SAKS.Models" column="AwardId" />
    </bag>

    
    
    
    <bag name="CompletePersons" table="Achi_CompletePersons" cascade="all-delete-orphan" >
      <key column="AchievementId"/>
      <element type="String" column="PersonName"/>
    </bag>
    <bag name="CompleteOrganizations" table="Achi_CompleteOrganizations" cascade="all-delete-orphan" >
      <key column="AchievementId"/>
      <element type="String" column="OrganizationName"/>
    </bag>
    <bag name="EvaluateOrganizations" table="Achi_EvaluateOrganizations" cascade="all-delete-orphan" >
      <key column="AchievementId"/>
      <element type="String" column="OrganizationName"/>
    </bag>
    <bag name="RecommendOrganizations" table="Achi_RecommendOrganizations" cascade="all-delete-orphan" >
      <key column="AchievementId"/>
      <element type="String" column="OrganizationName"/>
    </bag>
    
  </class>
</hibernate-mapping>